import { createStore } from 'vuex'
import { IState, ISwiper } from '../types/index'
import { getHomeData } from '@/api/index'
const state: IState = {
  count: 100,
  swiperList: []
}
export default createStore({
  state: state,
  mutations: {
    initSwiper(state: IState, ary: ISwiper[]) {
      state.swiperList = ary
    }
  },
  actions: {
    initSwiper({ commit }) {
      getHomeData({
        name: "22",
        age: 22,
        date: 'fdf',
        page: 1,
        sex: 0
      }).then(data => {
        commit('initSwiper', data.top_stories)
      })
    }
  },
  modules: {
  }
})
